<template>
  <div class="integral-goods" v-if="goodsDetailInfo">
    <Scroll class="goods-scroll">
      <div class="inner">
        <div class="swiper-container">
          <swiper ref="mySwiper" :options="swiperOptions">
            <swiper-slide v-for="(item, index) of goodsDetailInfo.banners" :key="index">
              <img :src="item" alt style="width: 100%" />
            </swiper-slide>
            <div class="swiper-pagination" slot="pagination"></div>
          </swiper>
        </div>
        <div class="content">
          <div class="detail-top">
            <div class="title">{{goodsDetailInfo.name}}</div>
            <div class="desc">
              <span class="integral">{{goodsDetailInfo.score}}积分</span>
              <span class="num">库存：{{goodsDetailInfo.stock_count}}</span>
            </div>
          </div>
          <div class="way">
            <div class="express">
              <i></i>
              <span>{{parseInt(goodsDetailInfo.delivery_type) === 2 ? '快递配送' : parseInt(goodsDetailInfo.delivery_type) === 1 ? '到店自提' : '快递配送 或 到店自提'}}</span>
            </div>
            <div class="tip">
              <i></i>
              <span>{{goodsDetailInfo.must}}</span>
            </div>
            <div class="address">
              <i></i>
              <span>{{goodsDetailInfo.shop_address}}</span>
            </div>
          </div>
          <div class="intro-info">
            <div class="info-title">
              <i></i>
              <span>活动详情</span>
            </div>
            <div class="info-txt" v-if="goodsDetailInfo.detail" v-html="goodsDetailInfo.detail"></div>
            <div class="no-msg" v-else>暂无内容...</div>
          </div>
        </div>
      </div>
    </Scroll>
    <div class="btn">
      <div class="btn-box">
        <my-button name="立即兑换" @btnClick="handleSignClick" />
      </div>
    </div>
    <transition name="slide">
      <router-view></router-view>
    </transition>
  </div>
</template>
<script>
import Scroll from '@/components/scroll/scroll'
import GoodsDetail from '@/views/my/mixins/goods-detail'
export default {
  components: {
    Scroll
  },
  mixins: [GoodsDetail],
  data () {
    return {
      swiperOptions: {
        pagination: {
          el: '.swiper-pagination'
        }
        // Some Swiper option/callback...
      }
    }
  },
  methods: {
    handleSignClick () {
      this.$router.push({
        path: '/my/exchange-center/integral-goods/order',
        query: {
          delivery_type: this.goodsDetailInfo.delivery_type,
          id: this.$route.query.id
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
@import "@/styles/mixin.scss";
@include slideEnter();
.integral-goods {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  z-index: 7;
  touch-action: none;
  .goods-scroll {
    width: 100%;
    height: 100%;
  }
  .inner {
    padding-bottom: 1.5rem;
  }
  .btn {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1.44rem;
    border-top: 1px solid rgba(238, 238, 238, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    .btn-box {
      width: 6.78rem;
      font-size: 0;
    }
  }
  .scroll-container {
    width: 100%;
    height: 100%;
  }
  .swiper-container {
    width: 100%;
    height: 7.5rem;
  }
  .swiper-pagination {
    vertical-align: middle;
  }
  .swiper-container /deep/ .swiper-pagination-bullet-active {
    width: 0.2em;
    height: 0.2rem;
    border: 1px solid rgba(0, 4, 0, 1);
    background: transparent !important;
    border-radius: 50%;
  }
  .swiper-container /deep/ .swiper-pagination-bullet {
    width: 0.12rem;
    height: 0.12rem;
    background: rgba(0, 4, 0, 1);
    border-radius: 50%;
    transition: all 0.3s;
  }
  .content {
    width: 100%;
    padding: 0 0.36rem;
    box-sizing: border-box;
    .detail-top {
      padding: 1rem 0;
      border-bottom: 1px solid #eeeeee;
      .title {
        font-size: 0.38rem;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(0, 4, 0, 1);
        line-height: 0.57rem;
      }
      .desc {
        display: flex;
        justify-content: space-between;
        font-size: 0;
        margin-top: 0.38rem;
        .integral {
          font-size: 0.4rem;
          font-family: PingFang SC;
          font-weight: bold;
          color: rgba(0, 4, 0, 1);
          line-height: 0.4rem;
        }
        .num {
          font-size: 0.25rem;
          font-family: PingFang SC;
          font-weight: 400;
          color: rgba(0, 4, 0, 0.6);
          line-height: 0.25rem;
          margin-top: 0.15rem;
          vertical-align: bottom;
        }
      }
    }
    .way {
      .express,
      .tip,
      .address {
        width: 100%;
        height: 1.02rem;
        display: flex;
        align-items: center;
        i {
          display: inline-block;
          width: 0.37rem;
          height: 0.34rem;
          background: url("../../../assets/images/icon_tcq.png") no-repeat;
          background-size: cover;
          margin-right: 0.56rem;
        }
        span {
          flex: 1;
          font-size: 0.25rem;
          font-family: PingFang SC;
          font-weight: 400;
          color: rgba(0, 4, 0, 1);
          line-height: 1.02rem;
          border-bottom: 1px solid #eeeeee;
        }
      }
      .tip {
        // border-bottom: 1px solid #eeeeee;
        span {
          border-bottom: none;
          border-bottom: 1px solid #eeeeee;
        }
        i {
          width: 0.4rem;
          height: 0.4rem;
          background: url("../../../assets/images/buke.png") no-repeat;
          background-size: cover;
        }
      }
      .address {
        border-bottom: 1px solid #eeeeee;
        i {
          width: 0.4rem;
          height: 0.44rem;
          background: url("../../../assets/images/icon_dz.png") no-repeat;
          background-size: cover;
        }
      }
    }
    .intro-info {
      margin-top: 0.88rem;
      .info-title {
        font-size: 0;
        i {
          display: inline-block;
          width: 0.24rem;
          height: 0.06rem;
          background: rgba(4, 36, 45, 1);
          vertical-align: bottom;
          margin-right: 0.1rem;
        }
        span {
          font-size: 0.38rem;
          font-family: PingFang SC;
          font-weight: bold;
          color: rgba(0, 4, 0, 1);
          line-height: 0.3rem;
        }
      }
      .info-txt {
        font-size: 0.28rem;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(0, 4, 0, 1);
        line-height: 0.57rem;
        margin-top: 0.88rem;
        /deep/ img {
          width: 100%;
        }
      }
      .no-msg {
        font-size: 0.3rem;
        font-family: PingFang SC;
        font-weight: 400;
        color: #ccc;
        line-height: 1rem;
        text-align: center;
      }
    }
  }
}
</style>
